log using "$Rep_smokelabor/2_analysis/output_logs/appendix_table3.log", replace 
	
	use "$Rep_smokelabor/1_build/regdata/county_quarter.dta", clear 
	
	local tbl_settings_log format(%6.3f) parentheses(stderr) asterisk()
	local tbl_settings_pmil format(%6.1f) parentheses(stderr) asterisk()
	local append replace
	
	reghdfe d_pc_qwi_payroll  			pm25 [aw=seer_pop] , a(fe_countyqtroy fe_styr) vce(cluster countyfip fe_stqtros)
	summ pc_qwi_payroll [aw=seer_pop] if e(sample)
	local ymean=`r(mean)'
	regsave using "$Rep_smokelabor/2_analysis/output_tables/appendix_table3.dta", addlabel(yvar, "`ymean'") table(col_1, `tbl_settings_pmil') `append'
	local append append
	
	reghdfe d_pc_qwi_payroll  			pm25 pm10 [aw=seer_pop] , a(fe_countyqtroy fe_styr) vce(cluster countyfip fe_stqtros)
	summ pc_qwi_payroll [aw=seer_pop] if e(sample)
	local ymean=`r(mean)'
	regsave using "$Rep_smokelabor/2_analysis/output_tables/appendix_table3.dta", addlabel(yvar, "`ymean'") table(col_2, `tbl_settings_pmil') `append'
	local append append
	
	reghdfe d_pc_qwi_payroll  			pm25 o3 [aw=seer_pop] , a(fe_countyqtroy fe_styr) vce(cluster countyfip fe_stqtros)
	summ pc_qwi_payroll [aw=seer_pop] if e(sample)
	local ymean=`r(mean)'
	regsave using "$Rep_smokelabor/2_analysis/output_tables/appendix_table3.dta", addlabel(yvar, "`ymean'") table(col_3, `tbl_settings_pmil') `append'
	local append append
	
	reghdfe d_pc_qwi_payroll  			pm25 so2 [aw=seer_pop] , a(fe_countyqtroy fe_styr) vce(cluster countyfip fe_stqtros)
	summ pc_qwi_payroll [aw=seer_pop] if e(sample)
	local ymean=`r(mean)'
	regsave using "$Rep_smokelabor/2_analysis/output_tables/appendix_table3.dta", addlabel(yvar, "`ymean'") table(col_4, `tbl_settings_pmil') `append'
	local append append
	
	reghdfe d_pc_qwi_payroll  			pm25 no2 [aw=seer_pop] , a(fe_countyqtroy fe_styr) vce(cluster countyfip fe_stqtros)
	summ pc_qwi_payroll [aw=seer_pop] if e(sample)
	local ymean=`r(mean)'
	regsave using "$Rep_smokelabor/2_analysis/output_tables/appendix_table3.dta", addlabel(yvar, "`ymean'")  table(col_5, `tbl_settings_pmil') `append'
	local append append
	
	reghdfe d_pc_qwi_payroll  			pm25 pm10 o3 so2 no2  [aw=seer_pop] , a(fe_countyqtroy fe_styr) vce(cluster countyfip fe_stqtros)
	summ pc_qwi_payroll [aw=seer_pop] if e(sample)
	local ymean=`r(mean)'
	regsave using "$Rep_smokelabor/2_analysis/output_tables/appendix_table3.dta", addlabel(yvar, "`ymean'") table(col_6, `tbl_settings_pmil') `append'
	local append append
	
	preserve 
		use "$Rep_smokelabor/2_analysis/output_tables/appendix_table3.dta", replace
		drop if var == "r2"
		drop if var == "_id"
		drop if strpos(var, "_cons_") > 0
		replace var="outcome_mean" if var=="yvar"
		replace var="observations" if var=="N"
		ingap 3
		ingap 6
		ingap 9
		ingap 12
		ingap 15
		list , sep(0)
		saveold "$Rep_smokelabor/2_analysis/output_tables/appendix_table3.dta", replace
	restore 

log close
	
